package com.ruoyi.caiwu.controller;/**
 * @author :
 * @date : 2025-03-06 13:59
 * @description :
 **/

import com.ruoyi.caiwu.domain.AccountingVoucher;
import com.ruoyi.caiwu.domain.SubjectBalance;
import com.ruoyi.caiwu.service.SubjectBalanceService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * @description: TODO 科目余额控制层
 * @author: 杜晓南
 * @date: 2025/3/6 13:59
 * @version: 1.0
 */
@RestController
@RequestMapping("/subjectBalance")
public class SubjectBalanceController {


    @Autowired
    SubjectBalanceService subjectBalanceService;

    /**
    * //TODO 添加或修改科目余额表
    * @author 杜晓南
    * @date 2025/3/7 16:42
     * @param voucherDate
     * @param subjectId
     * @return com.ruoyi.common.core.web.domain.AjaxResult
    */
    @GetMapping("/insertSubjectBalance/{voucherDate}/{subjectId}")
    public AjaxResult insertSubjectBalance(Date voucherDate,Long subjectId){
        return subjectBalanceService.insertUpdateSubjectBalance(voucherDate,subjectId);
    }


    /**
    * //TODO 查询科目余额表
    * @author 杜晓南
    * @date 2025/3/7 16:47
     * @return com.ruoyi.common.core.web.domain.AjaxResult
    */
    @RequiresPermissions("caiwu:subjectBalance:list")
    @GetMapping("/selectSubjectBalance")
    public AjaxResult selectSubjectBalance(){
        return subjectBalanceService.selectSubjectBalance();
    }


}
